<?$gn = Group::group_names();?>
<style>
  .form_err {color:red; font-size: 90%; font-style:italic}
</style>
    
<div style="margin:10px">

    
    <div class="div_form">
            <h1>Users management</h1>
        <div>
            <a href="index.php?m=administration">Users list</a> | 
            <a href="index.php?m=administration&a=create_user">Create new user</a> |
            Update user <b><?=$data['user_name']?></b> (#<?=$data['user_id']?>)
        </div>
        
        <?if($error):?><div class="error">Something wrong!</div><?endif?>    
        <form class="form" action="index.php?m=administration&a=edit_user&s=submit&user_id=<?=$data['user_id']?>" method="POST" style="margin: 10px 30px;">
        
            <table>
                <tr>
                    <td>
                        Password:
                    </td>
                    <td>
                        <?if(isset($error['user_password'])):?><div class="form_err"><?=$error['user_password']?></div><?endif?>
                        <input type="text" name="user_password" value="">
                        (leave empty if doesn't need to change)
                    </td>
                </tr>
                <tr>
                    <td>
                        User email:
                    </td>
                    <td>
                        <?if(isset($error['user_email'])):?><div class="form_err"><?=$error['user_email']?></div><?endif?>
                        <input type="text" name="user_email" value="<?=$data['user_email']?>">
                    </td>
                </tr>
                <tr>
                    <td>
                        Real Name:
                    </td>
                    <td>
                        <input type="text" name="user_realname" value="<?=$data['user_realname']?>">
                    </td>
                </tr>
                <tr>
                    <td>
                        Group:
                    </td>
                    <td>
                        <select name="group_id">
                            <option value="0">-Select-</option>
                            <?foreach($gn as $gid=>$n):?>
                            <?$selected=($gid==$data['group_id'])?'selected':''?>
                            <option value="<?=$gid?>"  <?=$selected?>><?=$n?></option>
                            <?endforeach?>
                        </select>    
                    </td>
                </tr>
                <tr>
                    <td>
                        Status:
                    </td>
                    <td>
                        <select name="status">
                            <option value="0">-Select-</option>

                            <option value="1" <?=$selected=($data['status']==1)?'selected':''?>>Enable</option>
                            <option value="0" <?=$selected=($data['status']==0)?'selected':''?>>Disable</option>
                        </select> 
                    </td>
                </tr>
            </table>
            
            
        <input type="hidden" name="user_name" value="<?=$data['user_name']?>"><br/>

        <p><input type="submit" value="Update"><br/></p>
        </form>
    </div>   
</div>

<style>

td
{
padding:7px;
}
</style>